﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Lib.Controls;
using System.Data;
using Lib.Utilities;

public partial class App_form_Daotao_nhapdiem : fpage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                ScriptManager.GetCurrent(this).Services.Add(new ServiceReference("~/Service/wht_nsd.svc"));
                ScriptManager.GetCurrent(this).Services.Add(new ServiceReference("~/Service/wdt_ma.svc"));

                DataTable b_dt = new DataTable();
                LibTable.AddNewColumns(ref b_dt, new string[] { "MA", "TEN" });
                LibTable.AddNewRows(ref b_dt, new object[] { "HKI", "Học kỳ I" });
                LibTable.AddNewRows(ref b_dt, new object[] { "HKII", "Học kỳ II" });
                hocky.DataSource = b_dt;
                hocky.DataBind();
                b_dt.Clear();
                LibTable.AddNewRows(ref b_dt, new object[] { "DI", "Điểm thi đi" });
                LibTable.AddNewRows(ref b_dt, new object[] { "LAI", "Điểm thi lại" });
                LibTable.AddNewRows(ref b_dt, new object[] { "RL", "Điểm rèn luyện" });
                loai.DataSource = b_dt;
                loai.DataBind();
                //NAM
                namhoc.DataSource = dm_dt.FDM_NAM_LKE();
                namhoc.DataBind();

                //LOAI KT
                b_dt = dm_dt.FDT_LOAI_KIEMTRA_LKE();
                loaikt.DataSource = b_dt;
                loaikt.DataBind();

                lop.DataSource = dm_dt.FDT_PC_DIEM_LOP_LKE(LibConvert.ObjectToDouble(namhoc.SelectedValue), LibConvert.ObjectToString(hocky.SelectedValue));
                lop.DataBind();

                Lib.Helper.SessionHelper _nsd = new Lib.Helper.SessionHelper();
                mon.DataSource = Lib.Data.DataSql.GetData(new object[] { hocky.SelectedValue, LibConvert.ObjectToDouble(namhoc.SelectedValue), LibConvert.ObjectToDouble(lop.SelectedValue), _nsd.id_nsd }, "P_PC_MON_LKE");
                mon.DataBind();
            }
        }
        catch (Exception ex)
        {
            LibForm.Msg(this.Page, ex.Message);
        }
    }
}